package com.bilibili.ifelse;

import java.util.Scanner;

//数字华容道
public class arr2n {
    public static void main(String[] args) {
        comeon();
    }
//    public static int[][] zero() {
//        System.out.println("---------------------------------------------------------------------------------------");
//        System.out.println("---------------------------------------------------------------------------------------");
//        int[][] arr2n = new int[5][5];
//        int num = 0;
//        for (int i = 0; i < 5; i++) {
//            for (int j = 0; j < 5; j++) {
//                arr2n[i][j] = num;
// //               System.out.print(arr2n[i][j] + "\t");
//                num++;
//            }
//            System.out.println();
//        }
//        System.out.println();
//        System.out.println("---------------------------------------------------------------------------------------");
//        System.out.println("---------------------------------------------------------------------------------------");
//        return arr2n;
//    }
    public static void comeon(){
        boolean a = true ;
        Scanner come = new Scanner(System.in);
        System.out.println("请输入难度：(大于2)");
        int n12 = come.nextInt();
        while (a){
            System.out.println("目录：");
            System.out.println("1.新的开始");
            System.out.println("2.复位");
            System.out.println("3.退出");
            System.out.println("请输入：");
            int num = come.nextInt();
            switch (num){
                case 1:
                    start(n12);
                    break;
                case 2:
//                    int n3 = come.nextInt();
                    frist(n12);
                    break;
                case 3:
                    a = false ;
                    break;
                default:
                    System.out.println("请重新输入！！！");
            }
        }
    }
    public static void start(int n12) {
        System.out.println("---------------------------------------------------------------------------------------");
        System.out.println("---------------------------------------------------------------------------------------");
        int num = 0;
        int[][] arr2n = new int[n12][n12];
        System.out.println("难度：" + n12);
        for (int i = 0; i < n12; i++) {
            for (int j = 0; j < n12; j++) {
                int num1 = (int) (Math.random() * (n12));
                int num2 = (int) (Math.random() * (n12));
                int replace = arr2n[i][j];
                arr2n[i][j] = arr2n[num1][num2];
                arr2n[num1][num2] = replace;
            }
        }
        for (int i = 0; i < n12; i++) {
            for (int j = 0; j < n12; j++) {
                System.out.print(arr2n[i][j] + "\t");
            }
            System.out.println();
        }
                System.out.println("---------------------------------------------------------------------------------------");
                System.out.println("---------------------------------------------------------------------------------------");
    }
        public static int[][] frist ( int n3){
            System.out.println("---------------------------------------------------------------------------------------");
            System.out.println("---------------------------------------------------------------------------------------");
            int[][] arr2n = new int[n3][n3];
            int num = 0;
            for (int i = 0; i < arr2n.length; i++) {
                for (int j = 0; j < arr2n[i].length; j++) {
                    arr2n[i][j] = num;
                    num++;
                    System.out.print(arr2n[i][j] + "\t");
                }
                System.out.println();
            }
            System.out.println("---------------------------------------------------------------------------------------");
            System.out.println("---------------------------------------------------------------------------------------");
            return arr2n;
        }
}

